package com.cn.xc.utils;

/**
 * FUN: array tools class
 * 
 * @author sushy
 * @date 2016-3-23
 */
public class ArrayUtil {

	/**
	 * //# generic, judge an array whether is null or its length=0
	 * 	   
	 * @param <T>
	 * @param array
	 * @return boolean
	 */
	public static <T> boolean isEmpty(T[] array) {
		return array == null || array.length == 0;
	}

	/**
	 * //# generic, judge an array whether is not null and its length !=0
	 * 
	 * @param <T>
	 * @param array
	 * @return boolean
	 */
	public static <T> boolean isNotEmpty(T[] array) {
		return !ArrayUtil.isEmpty(array);
	}

	/**
	 * //# judge a int[] whether is null or its length=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isEmpty(int[] array) {
		return array == null || array.length == 0;
	}

	/**
	 * //# judge a int[] whether is not null and its length !=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isNotEmpty(int[] array) {
		return !ArrayUtil.isEmpty(array);
	}

	/**
	 * //# judge a long[] whether is null or its length=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isEmpty(long[] array) {
		return array == null || array.length == 0;
	}

	/**
	 * //# judge a long[] whether is null and its length !=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isNotEmpty(long[] array) {
		return !ArrayUtil.isEmpty(array);
	}

	/**
	 * //# judge a double[] whether is null or its length=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isEmpty(double[] array) {
		return array == null || array.length == 0;
	}

	/**
	 * //# judge a double[] whether is null and its length !=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isNotEmpty(double[] array) {
		return !ArrayUtil.isEmpty(array);
	}

	/**
	 * //# judge a char[] whether is null or its length=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isEmpty(char[] array) {
		return array == null || array.length == 0;
	}

	/**
	 * //# judge a char[] whether is not null and its length !=0
	 * 
	 * @param array
	 * @return boolean
	 */
	public static boolean isNotEmpty(char[] array) {
		return !ArrayUtil.isEmpty(array);
	}

}
